<?php
/**
 * Users and user rights management system module.
 *
 * @author Martn "DevelX" Jurča
 * @version 2009-07-31
 */
interface Users {
    /**
     * Registers user rights so thay may be checked later.
     *
     * @param String Name of the module registering rights.
     * @param Array $rights List of rights as defined by modules.
     */
    public function registerRights($module, $rights);

    /**
     * Checkes whether user has requested rights or not. If the right does not
     * exist, method returns false and triggers a warning. If current user is
     * root, the method returns true for any existing rights without further
     * checking.
     *
     * @param String $module Name of the module requesting checking.
     * @param String $id Rights ID string.
     * @return boolean True if the user has requested rights, false otherwise.
     */
    public function checkRights($module, $id);

    /**
     * Loggs in user according to data sent by http request.
     *
     */
    public function loginUser();

    /**
     * Returns record of currently logged in user. If no user is logged in,
     * returns false.
     *
     * @return Array record of currently logged user. The record does not
     *         contain user password.
     */
    public function &getUser();

    /**
     * Returns array of user data of all users loaded by RecordList library.
     * The array is returned by pointer.
     *
     * @return Array List of all users.
     */
    public function &getUsers();

    /**
     * Returns blank user records for creating new users. Rights nor groups
     * cannot be assigned this way.
     *
     * @return Array Blank user record.
     */
    public function getBlankUserRecord();
}
?>
